<h1>首页</h1>
<div id="s" style="width: 100px;height: 100px;background: #ccc">

</div>
<div id="b" style="width: 100px;height: 100px;background: greenyellow">

</div>
<script>
    var i=0;
    var objspan = document.createElement('span');
   while(i<10){
        objspan.innerHTML += i;
       i++;
    }
    document.getElementById("s").innerHTML=objspan.innerHTML;
    function add(){
        for(var j=0;j<10;j++) {
            objspan.innerHTML +=j;
        }
        document.getElementById("b").innerHTML=objspan.innerHTML;
    }
</script>
<input type="button" value='test' onclick="add()"/>